function PageUserLogin() {
  this._account = document.getElementById('input1');
  this._password = document.getElementById('input2');
  this._loginBtn = document.getElementById('button1');
  
  this._createElements();
}

PageUserLogin.prototype._createElements = function() {
  var _self = this;
  
  var func = function() { new RequestUtils()._pcustom('login', 'a=' + encodeURIComponent(_self._account.value) + '&p=' + encodeURIComponent(_self._password.value), function(result, params) { if (result.type) {
                                                                                                                                                                                                if (result.type == '{{$smarty.const.USER_TYPE_FACTORY|escape:javascript}}') {
                                                                                                                                                                                                  location.href = '?p=pagefactory&t=pageb1factoryworks&m=' + JSON.stringify({ a: 1, b: 1, c: 1, d: 1});
                                                                                                                                                                                                } else if (result.type == '{{$smarty.const.USER_TYPE_DESIGNER|escape:javascript}}') {
                                                                                                                                                                                                  location.href = '?p=pagedesigner&t=pageb1designerworks&m=' + JSON.stringify({ a: 1, b: 1, c: 1, d: 1});
                                                                                                                                                                                                } else if (result.type == '{{$smarty.const.USER_TYPE_FILM_CUTTER|escape:javascript}}') {
                                                                                                                                                                                                  location.href = '?p=pageeditor&t=pageb1editorworks&m=' + JSON.stringify({ a: 1, b: 1, c: 1, d: 1});
                                                                                                                                                                                                } else {
                                                                                                                                                                                                  window.alert('User Restricted');
                                                                                                                                                                                                }
                                                                                                                                                                                              } else {
                                                                                                                                                                                                window.alert('Incorrect Account and/or Password');
                                                                                                                                                                                              }
                                                                                                                                                                                            }, { pos: DOMUtils.findPos(_self._loginBtn) });
                        };
  this._account.onkeypress = function(e) { var code = DOMUtils.getEventCode(e);
                                           if (code == 13) {
                                             func();
                                           }
                                         };
  this._password.onkeypress = function(e) { var code = DOMUtils.getEventCode(e);
                                            if (code == 13) {
                                              func();
                                            }
                                          };
  
  this._loginBtn.onclick = function() { func(); };
};